#pragma once
#include "Buffer.h"

class Packet
{
public:
	virtual ~Packet(){}

	virtual short GetID() = 0;
	virtual int GetSize() = 0;

	virtual void Encode(Buffer* out) = 0;
	virtual void Decode(Buffer* in) = 0;
};

class AbstractPacketFactory
{
public:
	virtual Packet* CreatePacket() = 0;
};

template<class T> class PacketFactory : public AbstractPacketFactory
{
public:
	Packet* CreatePacket()
	{
		return new T();
	}
};